package ventana;

import model.DialogWarningModel;

import org.uqbar.arena.actions.MessageSend;
import org.uqbar.arena.layout.HorizontalLayout;
import org.uqbar.arena.widgets.Button;
import org.uqbar.arena.widgets.Label;
import org.uqbar.arena.widgets.Panel;
import org.uqbar.arena.windows.Dialog;
import org.uqbar.arena.windows.WindowOwner;

public abstract class ErrorDialog extends Dialog<DialogWarningModel> {
	
	public ErrorDialog(WindowOwner owner) {
		super(owner, new DialogWarningModel());
	}
	
    @Override
    protected void addActions(Panel panel) {
            panel.setLayout(new HorizontalLayout());
            new Button(panel).
            setCaption("Aceptar").
            onClick(new MessageSend(this, "close"));
    }
    
    @Override
    protected void createFormPanel(Panel mainPanel) {
            mainPanel.setLayout(new HorizontalLayout());
            new Label(mainPanel).bindValueToProperty("mensaje");
    }
    
    protected void setWarningMessage(String mensaje) {
    	this.getModelObject().setMensaje(mensaje);
    }
	

}
